package com.jianger.dao;

import com.jianger.pojo.Sessiondetail;
import com.jianger.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @author jianger
 * @ date  2018/4/6-15:01
 * @project com.jianger.dao
 */
public class ISessionDeatilDaoImpl implements ISessionDeatilDao {
    @Override
    public void save(Sessiondetail sessiondetail) {

        QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
        String sql = "insert into session_detail values(?,?,?,?,?,?,?,?,?,?,?,?)";

        Object[] params = {
                sessiondetail.getTask_id(),
                sessiondetail.getUser_id(),
                sessiondetail.getSession_id(),
                sessiondetail.getPage_id(),
                sessiondetail.getAction_time(),
                sessiondetail.getSearch_keyword(),
                sessiondetail.getClick_category_id(),
                sessiondetail.getClick_product_id(),
                sessiondetail.getOrder_category_ids(),
                sessiondetail.getOrder_product_ids(),
                sessiondetail.getPay_category_ids(),
                sessiondetail.getPay_product_ids()
        };
        try {
            qr.update(sql, params);
        } catch (SQLException e) {
            e.printStackTrace();
        }


    }
}
